<?php htmlTemplate('admin_header_frame.php');?>
<div class="title">区块列表<a  href="<?php echo MVC_WWW_HOST.'admin.php/admin/section/add/'?>" class="title_button">添加区块</a>
</div>

<table width="100%" cellspacing="1" cellpadding="3" id="listTable">
	<tr >
		<td colspan="9"><form action="">&nbsp;&nbsp;
		
		分类：<select name="scatid" id="scatid">
				<?php 
				if ($_GET['scatid']){
					echo '<option value="'.$_GET['scatid'].'">'.$_GET['cname'].'</option>';
				}
				?>
				<option value="0">全部</option>
				<?php foreach ($cate as $key=>$value):?>
				<option value="<?php echo $value['id'];?>"><?php echo $value['cname'];?></option>
				<?php 
				if(@$value['child']){
					foreach ($value['child'] as $k=>$v):?>
					<option value="<?php echo $v['id']?>">|----<?php echo $v['cname']?></option>
					<?php endforeach;
				}?>	
				<?php endforeach;?>
				</select>
		标识：<input type="text"  name="keys" value="<?php if(Http::get('keys')) echo Http::get('keys');?>">	
		
		名称：<input type="text" name="name" style="width:200px;" value="<?php if(Http::get('name')) echo Http::get('name');?>">
		<input type="submit" value="搜 索"  class="submit"/>
		</form>
		</td>
	</tr>
	<tr>
		<th width="30">&nbsp;&nbsp;<input type="checkbox" onclick="checkAllBox(this);">
		</th>
		<th align="left">&nbsp;&nbsp; 分类
		</th>
		<th align="left">&nbsp;&nbsp; 名称
		</th>
		<th align="left">&nbsp;&nbsp; 标识
		</th>
		<th align="left">&nbsp;&nbsp; 类型
		</th>
		<th align="left">&nbsp;&nbsp; 更新时间
		</th>
		<th align="left">&nbsp;&nbsp; 更新者
		</th>
		<th align="left">&nbsp;&nbsp; 备注
		</th>
		
		<th align="right">操作&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		</th>
		
	</tr>
	<?php foreach ($rs['list'] as $key=>$value ):?>	
	
	<tr>
		<td>&nbsp;&nbsp;<input type="checkbox" class="checkitem" value="<?php echo $value['id'];?>">
		</td>
		
		
		<td>&nbsp;&nbsp;
		<?php echo $value['cname'];?>
		
		</td>
		
		<td>
		&nbsp;&nbsp;
		<?php 
			if ($value['type']==1){
				$tname='推荐位';
				$url = 'href="'.MVC_WWW_HOST.'admin/section/editsectioncontent/sectionid/'.$value['id'].'"';
			}else{
				$tname='代码';
				$url = 'href="'.MVC_WWW_HOST.'admin/section/modify/id/'.$value['id'].'"';
			}
		?>
		<a <?php echo $url;?>><?php echo $value['name'];?></a>
		
		</td>
		
		<td>
		<div style="float:left;">&nbsp;&nbsp;
		<?php echo $value['keys'];?>
		</div>
		
		</td>
		<td>
		
		<div style="float:left;">&nbsp;&nbsp;
		<?php echo $tname;?>
		</div>
		</td>
		<td>
		<?php echo '<div style="float:left;">&nbsp;&nbsp;'.date("Y-m-d H:i:s",$value['dateline']).'</div>';?>
		
		</td>
		<td>
		<?php echo '<div style="float:left;">&nbsp;&nbsp;'.$value['upby'].'</div>';?>
		
		</td>
		<td>
		<?php echo '<div style="float:left;">&nbsp;&nbsp;'.$value['memo'].'</div>';?>
		
		</td>
		
		<td align="right">
		
		<a title="修改" href="<?php echo MVC_WWW_HOST.'admin/section/modify/id/'.$value['id'];?>"><img  src="<?php echo MVC_WWW_HOST.'img/edit.gif'?>" /></a>
		<a title="删除" href="javascript:;"><img onclick="getUrl('<?php echo MVC_WWW_HOST.'admin/section/del/id/'.$value['id'];?>',1,1)"  src="<?php echo MVC_WWW_HOST.'img/delete.gif'?>" /></a>
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
	</tr>	
	<?php endforeach;?>

	<tr style="background:#f4fafb;">
		<td align="left" colspan="9">
		<div style="float:left">
		&nbsp;&nbsp;&nbsp;		
		<input type="button" value="删除" onclick="delItems();"/> <br>

		</div>
		<div style="float:right"><?php echo $rs['html'];?>&nbsp;&nbsp;&nbsp;&nbsp;</div>
		</td>
	</tr>
</table>
<script>

var wwwHost = '<?php echo MVC_WWW_HOST;?>';
function  delItems()
{
	var items = getCheckItems();
	if(!items){
		parent.showAlert('请选择要删除选项！');
		return false;
	}
	var url = wwwHost+'admin/section/del/id/'+items;
	getUrl(url,1,1);
}

</script>